package es.bdt.form4;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.Locale;

@SuppressWarnings("serial")
public class RecorrerJFrame extends JFrame {

	private JPanel contentPane;
	

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					RecorrerJFrame frame = new RecorrerJFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public RecorrerJFrame() {
		this.iniciaPanel(Locale.getDefault());
	}
	
	public void iniciaPanel(Locale loc){
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JLabel lblLabel = new JLabel("Idioma: " + loc.getDisplayLanguage());
		contentPane.add(lblLabel, BorderLayout.NORTH);
		
		JButton btnCambiar = new JButton("cambiar");
		btnCambiar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				reseteaPanel(Locale.ENGLISH);
			}
		});
		contentPane.add(btnCambiar, BorderLayout.WEST);
		
		
		
	}
	
	public void reseteaPanel(Locale locale){
		iniciaPanel(locale);
		setBounds(99, 99, 449, 299);
		setBounds(100, 100, 450, 300);
	}

}
